package com.example.zzbus.data;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.SharedPreferences;

import com.example.zzbus.base.BaseApplication;

public class UserData {
    public static final String sp_isLogin="ud_isLogin";
    public static final String sp_userName="ud_userName";
    public static final String sp_userNick="ud_userNick";
    public static final String sp_userPhone="ud_userPhone";
    public static boolean isLogin(){
        boolean islogin=getSharedPreferences().getBoolean(sp_isLogin,false);
        return islogin;
    }
    public static void setBoolData(boolean value){
        getSharedPreferences().edit().putBoolean(sp_isLogin,value).apply();
    }
    public static void setSpString(String key,String value){
          getSharedPreferences().edit().putString(key,value).apply();
    }
    public static String getSpString(String key){
        return getSharedPreferences().getString(key,"");
    }
    @SuppressLint("WrongConstant")
    public static SharedPreferences getSharedPreferences(){
        return BaseApplication.getInstance().getSharedPreferences("user_data", Activity.MODE_APPEND);
    }
}
